Passed
Push — master ( 937909...503c6a )
by Eduardo
02:32
created

ipcMain.ondragstart   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
dl 8
loc 8
rs 10
nop 2
1
const electron = require('electron'),
2
  debug = require('debug')('main.bwa.fileinput');
3
4
const {
5
  app,
6
  BrowserWindow,
7
  Menu,
8
  ipcMain,
9
  dialog
10
} = electron;
11
12
// File input, select file dialog
13
ipcMain.on('bwa:input.file', function(event) {
14
  debug("Waiting for file selection");
15
  var filePath = dialog.showOpenDialog({
16
    title: "Select wordlist file",
17
    buttonLabel: "Open",
18
    properties: ['openFile', 'showHiddenFiles']
19
  });
20
  debug("Using selected file at {0}".format(filePath));
21
  event.sender.send('bwa:fileinput.confirmation', filePath);
22
});
23
24
/*
25
// On drag and drop file
26
ipcMain.on('ondragstart', function(event, filePath) {
27
  event.sender.startDrag({
28
    file: filePath,
29
    icon: appSettings.window.icon
30
  });
31
  debug('File drag filepath: {0}'.format(filePath));
32
  event.sender.send('bwa:fileinput.confirmation', filePath, true);
33
});
34
*/
35